<?php 	
		include ("config/conn.php");
		require_once ("header.php");
?><style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
.style1 {
	color: #19B1F5;
	font-weight: bold;
}
-->
</style>
<?php 
	if ($ad_check==0 && $user_check==0){
		header ("Location:error.php?code=406");
	}
?>
<?php
	$q_subject		=	"F1025";
	$q_department	=	"JTMK";
	$q_sem			=	2;
	$q_topic		=	"Pengenalan";
	$sql_get_question="SELECT * FROM question WHERE q_subject='$q_subject' AND q_department='$q_department' AND q_sem='$q_sem' AND q_topic='$q_topic' ORDER BY rand()
						LIMIT 4";
	$sql_view_quest=mysql_query($sql_get_question);
	$sql_view_quest2=mysql_query($sql_get_question);
	$result=mysql_fetch_assoc($sql_view_quest);
	$q_id=$result['q_id'];
	$sql_get_answer="SELECT * FROM answer WHERE ans_ques_id='$q_id'";
	$sql_view_answer=mysql_query($sql_get_answer);
	//$sql_view_answer2=mysql_query($sql_get_answer2);
	$result2=mysql_fetch_assoc($sql_view_answer);
	
?>
<form name="question" method="POST" action="<?php echo "engine/mark.engine.php?sub=".$q_subject."&&dep=".$q_department."&&topic=".$q_topic."&&sem=".$q_sem; ?>">
<table width="780" border="0" align="center">
  <tr>
    <td colspan="3"><span class="style1">QUESTION SECTION </span></td>
  </tr>
  <tr>
    <td width="262" bordercolor="#000000">TOPIC</td>
    <td width="11" bordercolor="#000000">:</td>
    <td width="1045" bordercolor="#000000"><?php echo $result['q_topic']; ?></td>
  </tr>
  <tr>
    <td bordercolor="#000000">SUBJECT</td>
    <td bordercolor="#000000">:</td>
    <td bordercolor="#000000"><?php echo $result['q_subject']; ?></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Department</td>
    <td bordercolor="#000000">:</td>
    <td bordercolor="#000000"><?php echo $result['q_department']; ?></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000"><hr></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000">Soalan : </td>
  </tr>
</table>
<br>
<?php
	$count=1;
	while ($question = mysql_fetch_assoc($sql_view_quest2)) { 
		$test=$question['q_id'];
		$sql_get_answer2="SELECT * FROM answer WHERE ans_ques_id='$test' ORDER BY rand()";
		$sql_view_answer2=mysql_query($sql_get_answer2);
?>
<table width="780" border="0" align="center">
  <tr>
    <td width="23"><?php echo $count."."; ?></td>
    <td colspan="2"><?php echo $question['q_question']; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td width="90">&nbsp;</td>
    <td width="653"><br><?php while ($answer = mysql_fetch_assoc($sql_view_answer2)) { ?>
	<input name="answer_<?php echo $count; ?>" type="radio" value="<?php echo $answer['ans_id']; ?>"/> <?php echo $answer['ans_answer']. "<br>"; }
	?><BR><BR></td>
  </tr><?php $count++; } ?>
</table>
<center><input type="submit" name="submit" value="SUBMIT"/></center>
</form>
<p>&nbsp;</p>
<p><br><br></p>

<?php 	require_once ("footer.php"); ?>

